package org.dr.springmvcdemo.thymeleaf.demo;



import jakarta.validation.constraints.*;
import lombok.Data;

@Data
public class Customer {
    private String firstName;

    @NotNull(message = "is required")//验证注解，message：是验证失败后返回的信息
    @Size(min = 1, message = "is required")//确保latstName长度至少1
    private String lastName;

    @Min(value = 0, message = "must be greater than or equals to 0")
    @Max(value = 10, message = "must be smaller than or equals to 10")
    private int freePasses;

    @Pattern(regexp = "^[a-zA-Z0-9]{5}", message = "only 5 chars/digits")
    private String postalCode;

}


